﻿using System;
using System.Collections.Generic;
using System.Text;
using Pixysoft.Weblications.Sango.Dao;
using Pixysoft.Weblications.Sango.Constant;

namespace Pixysoft.Weblications.Sango.Mission.m000
{
    class UpgradeMainBuilding : MainMissionHandler
    {
        long level = -1;

        public override void initialize(Entities.Mis_Mainmission mission)
        {
            base.initialize(mission);

            this.level = int.Parse(mission.Codeparameters);
        }

        public override bool handle(string userCode, Entities.Usr_Mainmission mission)
        {
            // 直接判断玩家主城等级是否满足

            Entities.Usr_Building building = UsrBuildingDao.tryGetUserBuilding(userCode, CtiBuildingTypecodeCollection.MAIN);

            if (building == null)
                return false;

            if (building.Buildinglevel >= level)
                return true;

            return false;
        }
    }
}
